package com.adou.d5;

import java.util.Scanner;

public class Test3 {
    public static void main(String[] args) {
        System.out.println(getAverageScore(3));
    }

    public static double getAverageScore(int number) {
        int[] scores = new int[number];
        Scanner sc = new Scanner(System.in);

        for (int i = 0; i < scores.length; i++) {
            System.out.println("请您录入第"+(i+1)+"个评委分数：");
            int score = sc.nextInt();
            scores[i] = score;
        }

        int sum = 0;
        int max = scores[0];
        int min = scores[0];

        for (int i = 0; i < scores.length; i++) {
            int score = scores[i];
            sum += score;
            if(score > max) {
                max = score;
            }

            if(score < min) {
                min = score;
            }
        }

        double avg =1.0 * (sum - min - max)/(number-2);
        return avg;
    }
}


